package com.sanhuo.utils.basic;


/**
 * @author zzs
 * @version 1.0
 * @describe 字符串拼接工具类
 * @createTime 2018.1.5
 */
public class StringBuilderUtil {

    /**
     * 移除最后一个substr
     *
     * @param stringBuilder
     * @param subStr
     * @return
     */
    public static String removeLastStr(StringBuilder stringBuilder, String subStr) {
        int lastIndex = stringBuilder.lastIndexOf(subStr);
        if (lastIndex > 0) {
            return stringBuilder.substring(0, lastIndex);
        }
        //截取0到lastIndex的字符串
        return stringBuilder.toString();
    }


}
